#ifndef __MASTER_H__
#define __MASTER_H__

#include "common.h"
#include "encode_decode.h"
#include "cnf.h"
#include "clause.h"
#include "var.h"
#include "myqueue.h"
#include<mpi.h>
extern MPI_Datatype mpi_metadata_t;
enum WORKMOD{
    TASK_APPOINT_SAME_TACTIC,    
    SAME_TASK_DIFF_TACTIC,
};
typedef struct _master
{
    int workmod;
    int rank;
    int n_worker;
    _bool result;
    queue* available_worker;
    queue* tasks;
    cnf* init_cnf;
    cnf* result_cnf;
}master;

master* new_master(int rank, int n_worker, cnf* _cnf, int type);
void start_all_worker(master* m);
_bool listen_to_workers(master* m);
int prepare_all_sub_tasks(master* m);

#endif